<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ include file="/WEB-INF/view/common/kendocommon.jsp"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title>新增用户</title>
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
	    <style>
    	body {
			padding: 0;
			font-size: 12px;
		}
		h1 {
		    font: 14px "Helvetica Neue", Helvetica, Arial, sans-serif;
		    padding: 0px 0px 10px 10px;
		    display: block;
		    border-bottom: 1px solid #DADADA;
		    margin: 10px 10px 10px 10px;
		    color: #888;
		    text-align: center;
		}
    </style>
  </head>
  <script>
  var selectItem;
  var sex;
	$(document).ready(function() {
		var admissionDataSource = new kendo.data.DataSource({
            transport:{
                read:{
                    url: "${path}/common/getBaseCodeList?type=admission_way",
                    dataType: "json"
                }
            }
        });
	
		$("#admission_way").kendoComboBox({
		    dataTextField: "name",
		    dataValueField: "code",
		    dataSource: admissionDataSource
		});
		
		
		$("#birthday").kendoDatePicker({
			format: "yyyy-MM-dd",
			  animation: false
			});

		
		$("#c_role_id").kendoComboBox({
	     	dataValueField: "role_id",
	        dataTextField: "role_name",
	        dataSource: [{"role_id":"0","role_name":"孩子"}],//roleDataSource,
	        select: function(e) {
				var value = this.value();
				var item = e.item;  							      					    
				selectItem=e.sender.dataItem(item);
				//console.log(selectItem);
			}
		});
		
		$("#sex_code").kendoComboBox({
	     	dataValueField: "sex_code",
	        dataTextField: "sex",
	        dataSource: [{"sex":"男","sex_code":"1"},{"sex":"女","sex_code":"2"}],
	        select: function(e) {
				var value = this.value();
				var item = e.item;  							      					    
				sex=e.sender.dataItem(item);
				//console.log(selectItem);
			}
		});
		
		$("#admission_way").kendoComboBox({
	     	dataValueField: "code",
	        dataTextField: "name",
	        dataSource: wayDataSource,
	        select: function(e) {
				var value = this.value();
				var item = e.item;  							      					    
				sex=e.sender.dataItem(item);
				//console.log(selectItem);
			}
		});
	});
	
	
	
	  var roleDataSource = new kendo.data.DataSource({
			transport: {
			  	read: {
			  	//url: spera.spera_consume
		  		  	url: "${path}/business/getRoleList",
		   		  	dataType: "json",
				  	data:{}
 			  	}
			}
		});
	  
	  var wayDataSource = new kendo.data.DataSource({
			transport: {
			  	read: {
			  	//url: spera.spera_consume
		  		  	url: "${path}/common/getBaseCodeList",
		   		  	dataType: "json",
				  	data:{type:"admission_way"}
			  	}
			}
		});
	
	
	var subRegister = function(){
		//var formval = JsonCode(register);

		var formval = $('#register').serialize(); 
		//console.log(formval);
		//formval = JSON.stringify(formval);
		//console.log(formval);
		$.ajax({
            url: '${path}/business/addUserSubmit',
            data: formval,
            dataType: 'json',
            success: function(doc) {
            	layer.msg(doc.msg, {time: 3000, icon:6});
            	//toastr.info(doc.msg, "提示", toastrOptsTop);
            }
        });
	}
	


	</script>
  <body>
    <form id="register" name="register" action="" method="post">
	<input type="hidden" name="t_user_id" id="t_user_id" value="${t_user_id}"/>
	<input type="hidden" name="t_username" id="t_username" value="${t_username}"/>
	<div style="width:100%;padding-top:10px;text-align:center;">

		<table style="width:100%;padding:2px;text-align:center">
			<tr>
				<td  colspan="4">
					<h1>宝宝信息</h1>
				</td>
			</tr>
			<tr>
				<td>
					<label style="color:red">真名</label>
				</td>
				<td style="text-align:left">
					<input type="text" placeholder="真名" name="real_name" id="real_name" style="width:250px;margin:2px" class="k-textbox">
				</td>
				<td>
					<label style="color:red">性别</label>
				</td>
				<td style="text-align:left">
					<input type="text" placeholder="性别" name="sex_code" id="sex_code" style="width:250px;margin:2px" >
				</td>
			</tr>
			<tr>
			
				<td>
					<label style="color:red">昵称（英文名）</label>
				</td>
				<td style="text-align:left">
					<input type="text" placeholder="家庭称谓" name="member_name" id="member_name" style="width:250px;margin:2px" class="k-textbox">
				</td>
				
				<td>
					<label style="color:red">生日</label>
				</td>
				<td style="text-align:left">
					<input type="text" placeholder="生日" name="birthday" id="birthday" style="width:250px;margin:2px" >
				</td>
			</tr>
			<tr>
				<td colspan="4">
					<h1>家长信息</h1>
				</td>
			</tr>		
			<tr>
				<td>
					<label style="color:red">手机号</label>
				</td>
				<td style="text-align:left">
					<input type="text" placeholder="手机号" name="phone" id="phone" style="width:250px;margin:2px" class="k-textbox">
				</td>
				<td>
					<label>工作</label>
				</td>
				<td style="text-align:left">
					<input type="text" placeholder="工作" name="work" id="work" style="width:250px;margin:2px" class="k-textbox">
				</td>				

			</tr>				
			
			
			<tr>
				<td>
					<label>住址</label>
				</td>
				<td style="text-align:left">
					<input type="text" placeholder="住址" name="address" id="address" style="width:250px;margin:2px" class="k-textbox">
				</td>					
				<td>
					<label>受教育程度</label>
				</td>
				<td style="text-align:left">
					<input type="text" placeholder="受教育程度" name="education" id="education" style="width:250px;margin:2px" class="k-textbox">
				</td>												
			</tr>				
			
			<tr>
			
				<td>
					<label>身份证</label>
				</td>
				<td style="text-align:left">
					<input type="text" placeholder="身份证" name="identity_card" id="identity_card" style="width:250px;margin:2px" class="k-textbox">
				</td>					
				<td>
					<label>电子邮箱</label>
				</td>
				<td style="text-align:left">
					<input type="text" placeholder="email" name="email" id="email" style="width:250px;margin:2px" class="k-textbox">
				</td>								
			</tr>					
			
			<tr>
				<!-- <td>
					<label style="color:red">角色</label>
				</td>
				<td style="text-align:left">
					<input name='c_role_id' id='c_role_id' style="width:250px;margin:2px">
				</td> -->					
				<td>
					<label style="color:red">入会来源</label>
				</td>
				<td style="text-align:left">
					<input type="text" placeholder="入会来源" name="admission_way" id="admission_way" style="width:250px;margin:2px" >
				</td>							
			</tr>						
			<tr>
				<td>
					<label>入会备注</label>
				</td>
				<td colspan="3" style="text-align:left">
					<textarea name="admission_note" id="admission_note" style="width:90%;height:150px;margin:2px" class="k-textbox"></textarea>
                </td>
			</tr>
		</table>
	</div>
    </form>
    <div style="text-align:center;">
    	<button  class="btn" onclick="subRegister()">
        	确认注册
    	</button>
    </div>
  </body>
</html>
